<?php
$this->pageTitle = Yii::app()->name . ' - ' . Yii::t('home', 'payment');
$this->breadcrumbs = array(
    Yii::t('home', 'payment') => array(Yii::t('app', 'index')),
    Yii::t('paymentmanagement', 'vieworder') . ' (' . $order->order_id . ')',
);

if (Yii::app()->user->isGuest) {
    $baseUrl = Yii::app()->getBaseUrl(true);
    $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
        'id' => 'mydialog',
        // additional javascript options for the dialog plugin
        'options' => array(
            'title' => Yii::t('home', 'message'),
            'autoOpen' => true,
            'modal' => true,
            'beforeClose' => 'js:function(){window.location = "' . $baseUrl . '/index.php?r=index";}',
            'buttons' => array(
                Yii::t('home', 'close') => 'js:function(){window.location = "' . $baseUrl . '/index.php?r=login";}'
            ),
        ),
    ));

    echo Yii::t('home', 'require_login');

    $this->endWidget('zii.widgets.jui.CJuiDialog');
    return;
}
?>
<div class="wrapper row3">
    <main class="container clear">
        <h1><?= Yii::t('foretell', 'view') ?></h1>

        <table style="width: 500px;">
            <tr>
                <th style="min-width: 150px;"></th>
                <th></th>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('foretell', 'package') ?></td>
                <td><?= $order->package["package_name_" . Yii::app()->language] ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('foretell', 'price') ?></td>
                <td><?= $order->price ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('foretell', 'foretell_type') ?></td>
                <td><?= ForetellTypeUtil::getForetellType($order->option_type) ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'firstname') ?></td>
                <td><?= $order->name ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'lastname') ?></td>
                <td><?= $order->surname ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'height') ?></td>
                <td><?= $order->height ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'weight') ?></td>
                <td><?= $order->weight ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'gender') ?></td>
                <td><?= ConvertFormatUtil::getFullGender($order->sex) ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'birthday') ?></td>
                <td><?= ConvertFormatUtil::getThaiDate($order->birthdate) ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'mobilephone') ?></td>
                <td><?= $order->contact_tel ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('foretell', 'remark') ?></td>
                <td><?= $order->remark ?></td>
            </tr>
            <tr>
                <td style="text-align: right;"><?= Yii::t('register', 'profile_image') ?></td>
                <?php if (isset($order->picture) && $order->picture != '') : ?>
                    <td><?php echo CHtml::link(Yii::t('foretell', 'show'), 'javascript:void(0)', array('id' => 'show_picture', 'onclick' => '$("#picturedialog").dialog("open"); return false;')); ?></td>
                    <?php
                    $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
                        'id' => 'picturedialog',
                        // additional javascript options for the dialog plugin
                        'options' => array(
                            'title' => Yii::t('home', 'picture'),
                            'autoOpen' => false,
                            'resizable' => false,
                            'modal' => true,
                            'width' => 'auto',
                            'height' => 'auto'
                        )
                    ));

                    $baseUrl = Yii::app()->getBaseUrl(true);
                    echo '<img id="image" src="' . $baseUrl . '/' . $order->picture . '"/>';

                    $this->endWidget('zii.widgets.jui.CJuiDialog');
                else:
                    ?>
                    <td></td>
                <?php endif; ?>
            </tr>
            <tr>
                <td style="text-align: right;">&nbsp;</td>
                <td><?php echo CHtml::button(Yii::t('foretell', 'back'), array('onclick' => 'js:window.location = "' . Yii::app()->getBaseUrl(true) . '/index.php?r=payment"')); ?></td>
            </tr>


        </table>
    </main>
</div>